package com.hmall.mapper;

import com.hmall.model.MallProductPlan;
import com.hmall.util.MyMapper;
import com.hmall.vo.BackPlanVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface MallProductPlanMapper extends MyMapper<MallProductPlan> {

//    void myInsert1(@Param("planNo") Long planNo, @Param("userId") Integer userId, @Param("dealWay") String dealWay, @Param("shippingId") Integer shippingId,
//                  @Param("remark") String remark, @Param("status") Integer status, @Param("dealerId") Integer dealerId, @Param("salesId") Integer salesId, @Param("submitPerson") Integer submitPerson);

    List<MallProductPlan> listProductPlan(@Param("userId") Integer userId);

    List<MallProductPlan> listProductPlanByPlanId(@Param("planId") int planId);

    List<Integer> selectByDeptId(@Param("deptId") Integer deptId);

    List<Long> selectByPlanId(@Param("planId") int planId);

    void updatePlan(@Param("planId") Integer planId, @Param("status") Integer status);

    Integer selectSaleUserIdByPlanId(@Param("planId") int planId);

    String selectRemarkByPlanId(@Param("planId") int planId);

    int selectStatusByPlanId(@Param("planId") int planId);

    void updatePlanToDo(@Param("endDate") Date endDate);

    List<MallProductPlan> selectByStatus(@Param("status") int i);

    MallProductPlan selectNewestOne(@Param("userId") Integer userId);

    String selectCreateTime(@Param("userId") Integer userId);

    void myUpdate(@Param("planId") Integer planId, @Param("userId") Integer userId, @Param("remark") String remark, @Param("status") int status, @Param("dealerId") Integer dealerId,
                  @Param("salesId") Integer salesId, @Param("submitPerson") Integer submitPerson);


    List<MallProductPlan> listProductPlanByPlanIdList(@Param("planIdList") List<Integer> idListInt);

    MallProductPlan selectByPlanNo(@Param("planNo") long planNo);

    List<MallProductPlan> listAllPlanListByUser(@Param("userId") Integer userId);

    List<BackPlanVo> selectPlanVoList(@Param("userId") Integer userId, @Param("customerUserId") Integer customerUserId, @Param("status") Integer status);

    List<MallProductPlan> selectProductPlanByStatusAndCustomerId(@Param("userId") Integer userId, @Param("customerId") Integer customerId, @Param("status") Integer planDBStatus,
                                                                 @Param("check") Integer check);

    //需求修改....
    List<MallProductPlan> selectProductPlanByStatusAndSalesmanIdList(@Param("salesmanIdList") List<Integer> salesmanIdList, @Param("customerUserId") Integer customerUserId, @Param("status") Integer status);

    void updatePlanByPlanNoAndStatusWithOpinion(@Param("planNo") Long planNo, @Param("opinion") String opinion, @Param("status") int dbStatus);

    //改为
    List<MallProductPlan> selectByCustomerUserIdWithStatus(@Param("salesmanIdList") List<Integer> salesmanIdList, @Param("customerUserId") Integer customerUserId, @Param("status") int planDBStatus);


    MallProductPlan selectThisMonthPlan(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("userId") Integer userId);

    void updatePlanStatusOverTime(@Param("date") Date nowDate);

    List<MallProductPlan> selectByTime(@Param("start") Date nowDate, @Param("end") Date thisDate);

    int selectCountByUserId(@Param("userId") Integer userId);

    int selectCountByUserIdWithTime(@Param("userId") Integer userId, @Param("leftTime") Date leftTime, @Param("rightTime") Date rightTime);

    List<MallProductPlan> selectByUserIdWithTime(@Param("userId") Integer userId, @Param("leftTime") Date leftTime, @Param("rightTime") Date rightTime);
}